import struct

file8 = "8k-00.bin"
file8ff = "8k-ff.bin"
file32 = "32k-up.bin"
file32_00 = "32k-00.bin"
file32_ff = "32k-ff.bin"
file64 = "64k-00.bin"
file010 = "010-00.bin"
file010ff = "010-ff.bin"
file010up = "010-up.bin"
file020 = "020-00.bin"
file020ff = "020-ff.bin"
file020up = "020-up.bin"
file040 = "040-00.bin"
file040up = "040-up.bin"


file64up = "64k-up.bin"
with open(file64up,mode='wb+') as f:
    for i in range(2**16):
        if i&0xff==0:
            s = struct.pack('B',(i>>8)&0xff)
            f.write(s)
        # elif i&0xff==1:
        #     s = struct.pack('B',i&0xff)
        #     f.write(s)
        else:
            s = struct.pack('B',i&0xff)
            f.write(s)

with open(file8,mode='wb+') as f:
    # 8k  2**13
    # 32k 2**15
    # 64k 2**16
    for i in range(2**13):
        s = struct.pack('B',0x00)
        f.write(s)

with open(file8ff,mode='wb+') as f:
    # 8k  2**13
    # 32k 2**15
    # 64k 2**16
    for i in range(2**13):
        s = struct.pack('B',0xff)
        f.write(s)
with open(file32,mode='wb+') as f:
    # 8k  2**13
    # 32k 2**15
    # 64k 2**16
    for i in range(2**15):
        s = struct.pack('B', i & 0xff)
        # s = struct.pack('B',0x00)
        f.write(s)
with open(file32_00,mode='wb+') as f:
    for i in range(2**15):
        s = struct.pack('B', 0)
        f.write(s)
with open(file32_ff,mode='wb+') as f:
    for i in range(2**15):
        s = struct.pack('B', 0xff)
        f.write(s)


with open(file64,mode='wb+') as f:
    # 8k  2**13
    # 32k 2**15
    # 64k 2**16
    for i in range(2**16):
        s = struct.pack('B',0x00)
        f.write(s)

with open(file040,mode='wb+') as f:
    # 8k  2**13
    # 32k 2**15
    # 64k 2**16
    for i in range(2**19):
        s = struct.pack('B',0x00)
        f.write(s)

with open(file010,mode='wb+') as f:
    # 8k  2**13
    # 32k 2**15
    # 64k 2**16
    for i in range(2**17):
        # s = struct.pack('B',0x00)
        s = struct.pack('B',0x00)
        f.write(s)

with open(file010ff,mode='wb+') as f:
    # 8k  2**13
    # 32k 2**15
    # 64k 2**16
    for i in range(2**17):
        # s = struct.pack('B',0x00)
        s = struct.pack('B',0xff)
        f.write(s)

with open(file010up,mode='wb+') as f:
    # 8k  2**13
    # 32k 2**15
    # 64k 2**16
    for i in range(2**17):
        # s = struct.pack('B',0x00)
        s = struct.pack('B',0xff & i)
        f.write(s)

with open(file020,mode='wb+') as f:
    # 8k  2**13
    # 32k 2**15
    # 64k 2**16
    for i in range(2**18):
        s = struct.pack('B',0x00)
        f.write(s)

with open(file020up,mode='wb+') as f:
    # 8k  2**13
    # 32k 2**15
    # 64k 2**16
    for i in range(2**18):
        s = struct.pack('B',i & 0xff)
        f.write(s)
with open(file020ff,mode='wb+') as f:
    # 8k  2**13
    # 32k 2**15
    # 64k 2**16
    for i in range(2**18):
        s = struct.pack('B',0xff)
        f.write(s)

with open(file040up,mode='wb+') as f:
    for ii in range(8):
        for i in range(2**16):
            s = struct.pack('B',i&0xff)
            f.write(s)